package jtk.project4.fleet.field;

import java.awt.Dimension;
import java.text.SimpleDateFormat;

import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.control.CalendarControl;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.MemoField;
import nl.coderight.jazz.form.field.SelectField;
import nl.coderight.jazz.form.field.SpinnerField;
import nl.coderight.jazz.form.field.TextField;
import nl.coderight.jazz.form.field.lookup.LookupField.ListModel;
import nl.coderight.jazz.form.field.scrollable.ScrollableField;


public class AddEditFuelReceiptField extends GroupControl{
	private CalendarControl date;
	private SpinnerField<Integer> quantity;
	private TextField unitCost;
	private TextField extendedCost;
	private SelectField<String> vendor;
	private MemoField comments;
	private ScrollableField<Integer> quantity1;
	Integer[] ee;

	
	public AddEditFuelReceiptField(String bindID) {
		setBindID(bindID);
		createFields();
		createLayout();
	}
	
	private void createFields(){
		date = new CalendarControl("date", 20);
		date.setFormat(new SimpleDateFormat());
		date.showYearSpinner(true);
		date.setPreferredSize(new Dimension(166, 20));
		date.setRequired(true);
		unitCost =  new TextField("unit cost", 20);
		unitCost.setRequired(true);
		extendedCost =  new TextField("extended cost", 20);
		extendedCost.setEditable(false);
		vendor = new SelectField<String>("domains", "domain");
		vendor.setPreferredSize(new Dimension(166, 20));
		vendor.insert("Amoco", true);
		vendor.insert("Auction", true);
		comments =  new MemoField();
		comments.setRows(4);
		quantity = new SpinnerField<Integer>("domains", "domain");
		quantity.setPreferredSize(new Dimension(50, 20));
		for(int i=1;i<=1000;i++)
			quantity.insert(i, true);
		
	}
	
	private void createLayout(){
		setLayout(new FormLayout())
		.addLabel("Date:") 			.addField(date)
		.addRow()
		.addLabel("Quantiy:") 			.addField(quantity)
		.addRow()
		.addLabel("Unit Cost:")		.addField(unitCost)
		.addRow()
		.addLabel("Extended Cost:") .addField(extendedCost)
		.addRow()
		.addLabel("Vendor:") 		.addField(vendor)
		.addRow()
		.addLabel("Comments")  		.addField(comments)
		;
	}
	
	
}
